Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docs: Rename Block Hooks handbook page to Block Filters #54862

Merged
merged 3 commits into from
Sep 27, 2023

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Sep 27, 2023

What?

Rename the handbook page currently entitled "Block Hooks" to "Block Filters".

Why?

To distinguish from the new "Block Hooks" feature, which is conceptually very different.

How?

By renaming the handbook page from "Block Hooks" to "Block Filters".

AFAICT, the handbook page makes no direct reference to hooks, other than the title; furthermore, the relevant client-side @wordpress/ package happens to be called @wordpress/hooks. Reading the page, it’s all about filters though (both on the client and server sides), whereas "hooks" traditionally denotes the union of filters and actions — the latter of which are pretty much absent from the page.

Finally, note that the filename has already been block-filters.md before.

Thus, changing the title to "Block Filters" seems warranted.

Flagged by @juanmaguitar in Slack.

@ockham ockham added the [Type] Developer Documentation Documentation for developers label Sep 27, 2023
@ockham ockham requested a review from ajitbohra as a code owner September 27, 2023 11:37
@ockham ockham self-assigned this Sep 27, 2023
@juanmaguitar
Copy link
Contributor

LGTM! 👍
We would also need to change the reference to this page from the landing page of Reference Guides though.

@ockham
Copy link
Contributor Author

ockham commented Sep 27, 2023

LGTM! 👍 We would also need to change the reference to this page from the landing page of Reference Guides though.

Ah, good point! Done in 9b1bcdf.

@@ -18,7 +18,7 @@

## [Hooks Reference](/docs/reference-guides/filters/README.md)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also rename this to "Hooks and Filters Reference" now? Ripple effects... 😬

Suggested change
## [Hooks Reference](/docs/reference-guides/filters/README.md)
## [Hooks and Filters Reference](/docs/reference-guides/filters/README.md)

Copy link
Contributor

@juanmaguitar juanmaguitar Sep 27, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory, the concept "Hooks" would already include "Filters" (and "Actions") so I think the current two changes are enough for now for the purpose of this PR.
We can think later of a better way to name these Reference API pages

@ockham ockham merged commit e082f02 into trunk Sep 27, 2023
49 checks passed
@ockham ockham deleted the rename/block-hooks-handbook-page-to-block-filters branch September 27, 2023 13:09
@github-actions github-actions bot added this to the Gutenberg 16.8 milestone Sep 27, 2023
@ockham
Copy link
Contributor Author

ockham commented Sep 27, 2023

Merged.

@juanmaguitar @ndiego Does this need any extra work to replace the current docs over at https://developer.wordpress.org/block-editor/reference-guides/filters/block-filters/? Disregard, looks like it's already updated 😅

@ndiego
Copy link
Member

ndiego commented Sep 27, 2023

Yeah it updates every 15 minutes.

@gziolo
Copy link
Member

gziolo commented Sep 28, 2023

I led the effort to consolidate documentation pages explaining the usage of WordPress hooks with the editor at #42356. It doesn't always cover filters like it was called previously, so we decided to unify the vocabulary to follow WordPress core:

https://developer.wordpress.org/plugins/hooks/

It's also grouped under the "hooks" in the code reference:

https://developer.wordpress.org/reference/hooks/

The biggest difference between Gutenberg and WordPress core is that for core the documentation is generated from the source code, it's searchable, and based on individual use cases. On the contrary, only a subset of WordPress hooks available are documented in the block editor because it has to be done manually. If we were to follow WP core, then the issue wouldn't exist as we wouldn't have to divide filters and actions based on their role arbitrarily.

In conclusion, the phrase Block Hooks is confusing here, and Block Filters is a good short-term solution, but it's the issue that we have to manually maintain code references for WordPress hooks used with the editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants